import java.util.HashMap;
import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-09-19
 * Time: 22:35
 */
public class Test {
    static class Person{
        String id;

        public Person(String id) {
            this.id = id;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Person person = (Person) o;
            return Objects.equals(id, person.id);
        }

        @Override
        public int hashCode() {
            return Objects.hash(id);
        }
    }

    public static void main(String[] args) {
        Person person1 = new Person("123");
        Person person2 = new Person("123");
        HashBuck2<Person,String> hashBuck2 = new HashBuck2<>();
        hashBuck2.add(person1,"zhangsan");
        System.out.println(hashBuck2.get(person2));


    }
    public static void main2(String[] args) {
        Person person = new Person("123");
        Person person2 = new Person("123");
        System.out.println(person.hashCode());
        System.out.println(person2.hashCode());

    }
    public static void main1(String[] args) {
        HashBuck hashBuck = new HashBuck();
        hashBuck.add(1,151);
        hashBuck.add(2,11);
        hashBuck.add(3,11);
        hashBuck.add(14,11);
        hashBuck.add(5,11);
        hashBuck.add(6,11);
        hashBuck.add(7,11);
        hashBuck.add(8,11);
        hashBuck.add(9,11);
        hashBuck.add(10,11);
        System.out.println(hashBuck.get(1));

    }
}
